package com.atguigu.boot3.ssm.controller;

import com.atguigu.boot3.ssm.bean.People;
import com.atguigu.boot3.ssm.mapper.PeopleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class PeopleController {
    @Autowired
    PeopleMapper peopleMapper;

    //增
    @GetMapping("/c")
    public List<People> create(){
        peopleMapper.generatePeopleValue("xm","111111");
        List<People> people = peopleMapper.getAllPeopleValue();
        return people;
    }

    //查
    @GetMapping("/r")
    public List<People> read(){
        List<People> people = peopleMapper.getAllPeopleValue();
        return people;
    }

    //改
    @GetMapping("/u")
    public List<People> update(){
        peopleMapper.ModifyAllPwd2Nul();
        List<People> people = peopleMapper.getAllPeopleValue();
        return people;
    }

    //删
    @GetMapping("/d")
    public void delete(){
        peopleMapper.DestoryAllValue();
    }
}
